package com.taotao.portal.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.taotao.common.utils.JsonUtils;
import com.taotao.portal.pojo.AdItem;
import com.taotao.portal.service.AdService;

@Controller
public class PageController {

	@Autowired
	private AdService adService;
	
	@RequestMapping("/index")
	public String showIndex(Model model) {
		List<AdItem> list = adService.getAdItemList();
		String data=JsonUtils.objectToJson(list);
		model.addAttribute("ad1", data);
		return "index";
	}
	
	@RequestMapping("/{path}")
	public String page(@PathVariable String path) {
		return "path";
	}
	
	
}
